#define OPEN_DCHAT_OK     1
#define OPEN_DCHAT_ERROR  -1	

//定义文件描述符的类型
#define FD_SOCKET_LISTEN   1 //监听描述符
#define FD_SOCKET_ACCEPT   2 //客户连接产生的socket
#define FD_FILE_READ       3
#define FD_FILE_WRITE      4

#define maxfd 1024;

#pragma pack(1)
typedef struct
{
	char buffer[maxfd];
	int  start;
	int  length;
	int  state; //当前缓冲区的状态...这样不用每次都重新计算状态!
} fdBuffer;

typedef struct 
{
	int type;
	fdBuffer* readBuf;
	fdBuffer* writeBuf;
} fdDescription;

typedef struct
{
	int ip;
	int port;
}serverConfig;
typedef struct
{
	fdDescription description[maxFd];           //所有产生的各种文件描述符都在此
	int   readNotify[maxfd];    //这里面记录了需要关注读事件的文件描述符
	int   readNotifyNext;
	int   writeNotify[maxfd];   //这里面记录了需要关注写事件的文件描述符
	int   writeNotifyNext;
	int   readFired[maxfd];     //这里面记录了可读的文件描述符
	int   readFiredNext;
	int   writeFired[maxfd];    //这里面记录了可写的文件描述符
	int   writeFiredNext;
	serverConfig config;
	
	//epoll
	int epollfd;
	
	
} global;
#pragma pack()
